package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.pojo.Employee;
import com.atguigu.springcloud.service.FeginService;
import com.atguigu.springcloud.service.LoginService;
import com.atguigu.springcloud.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.UUID;

/**
 * @auther zzyy
 * @create 2020-02-19 16:06
 */
@RestController
@Slf4j
public class PaymentController
{
    @Value("${server.port}")
    private String serverPort;

    @Resource
    private FeginService feginService;

    @Resource
    private LoginService loginService;

    @RequestMapping(value = "/payment/consul")
    public String paymentConsul()
    {
        return "springcloud with consul: "+serverPort+"\t   "+ UUID.randomUUID().toString();
    }

    @GetMapping("/get/message")
    public String message(){
        return feginService.getCode();
    }

    @GetMapping("/get/name")
    public String name(){
        return feginService.getName();
    }

    @RequestMapping("/list")
    public Collection<Employee> login(){
        return feginService.list();
    }

}
